package com.sjx.jnistudy

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
import android.R.array
import android.util.Log


class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Example of a call to a native method
//        sample_text.text = stringFromJNI()
        sample_text.text = CalcUtils.getName()

        //调用数组
        val array = byteArrayOf('A'.toByte(), 'B'.toByte(), 'C'.toByte(), 'D'.toByte(), 'E'.toByte())
        val resutl = CalcUtils.getByteArray(array)
        for (i in array.indices) {
            Log.d("TAG", "ARRAY : " + array[i] + "->" + resutl[i])
        }
//        android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_AUDIO)
    }

    /**
     * A native method that is implemented by the 'native-lib' native library,
     * which is packaged with this application.
     */
    external fun stringFromJNI(): String

    companion object {

        // Used to load the 'native-lib' library on application startup.
        init {
            System.loadLibrary("native-lib")
            System.loadLibrary("calc-utils");

        }
    }
}
